package com.mars.module.admin.controller;


import com.mars.common.result.R;
import com.mars.module.admin.service.ISysStayApplicationService;
import com.mars.module.admin.service.ISysStudyAbroadService;
import com.mars.module.admin.service.ISysVisaApplicationService;
import com.mars.module.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@AllArgsConstructor
@RestController
@Api(value = "4.首页报表接口", tags = "4.首页报表接口")
@RequestMapping("/admin/report")
public class SysReportController {

    private final ISysUserService userService;
    private final ISysStayApplicationService stayApplicationService;
    private final ISysVisaApplicationService visaApplicationService;
    private final ISysStudyAbroadService studyAbroadService;

    @ApiOperation(value = "统计男女用户比例（饼状图）")
    @PostMapping("/sexCount")
    public R<Map<String, Long>> sexCount() {
        return R.success(userService.sexCount());
    }

    @ApiOperation(value = "统计用户国家比例（饼状图）")
    @PostMapping("/addressCount")
    public R<Map<String, Long>> addressCount() {
        return R.success(userService.addressCount());
    }

    @ApiOperation(value = "统计用户地区比例（饼状图）")
    @PostMapping("/areaCount")
    public R<Map<String, Long>> areaCount() {
        return R.success(userService.areaCount());
    }

    @ApiOperation(value = "统计专业的学生数量（柱状图）")
    @PostMapping("/majorStudentCount")
    public R<Map<String, Long>> majorStudentCount() {
        return R.success(userService.majorStudentCount());
    }

    @ApiOperation(value = "统计用户申请宿舍数据（折线图）")
    @PostMapping("/stayApplyCount")
    public R<Map<String, Long>> stayApplyCount() {
        return R.success(stayApplicationService.stayApplyCount());
    }

    @ApiOperation(value = "统计用户申请签证数据（折线图）")
    @PostMapping("/visaApplyCount")
    public R<Map<String, Long>> visaApplyCount() {
        return R.success(visaApplicationService.visaApplyCount());
    }

    @ApiOperation(value = "统计用户申请留学数据（折线图）")
    @PostMapping("/aboardApplyCount")
    public R<Map<String, Long>> aboardApplyCount() {
        return R.success(studyAbroadService.aboardApplyCount());
    }
}
